package com.dems.web;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dems.dao.StudentDao;
import com.dems.domain.Student;


@WebServlet("/UpdateStudentServlet")
public class UpdateStudentServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private StudentDao registStudentDao = new StudentDao();
    /**
     * @see HttpServlet#HttpServlet()
     */
    public UpdateStudentServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//获取参数
		String studentNum = request.getParameter("studentNum");
		String studentName = request.getParameter("studentName");
		String studentPassword = request.getParameter("studentPassword");
		String studentDormitory = request.getParameter("studentDormitory");
		String studentPhone = request.getParameter("studentPhone");
		Student student = new Student();
		student.setStudentNum(studentNum);
		student.setStudentName(studentName);
		student.setStudentPassword(studentPassword);
		student.setStudentDormitory(studentDormitory);
		student.setStudentPhone(studentPhone);
		StudentDao sd = new StudentDao();
		sd.update(student);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
